﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using System.ComponentModel;

namespace QinTools.ViewModel.Documents
{
    public class Document : ViewModelBase
    {
        #region Properties
        private string _Title;
        public string Title 
        {
            get
            {
                return _Title;
            }
            set
            {
                _Title = value;
                RaisePropertyChanged("Title");
            }
        }

        private bool _ModelHasChanged;
        public bool ModelHasChanged
        {
            get
            {
                return _ModelHasChanged;
            }
            private set
            {
                _ModelHasChanged = true;
                RaisePropertyChanged("ModelHasChanged");
            }
        }
        
        public INotifyPropertyChanged Model { get; private set; }

        public bool IsActive { get; private set; }
        #endregion
        #region Constructors
        private Document() { }
        public Document(INotifyPropertyChanged model)
        {
            Model = model;
            Model.PropertyChanged += new PropertyChangedEventHandler(Model_PropertyChanged);
        }
        #endregion
        #region Event Handlers
        void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ModelHasChanged = true;
        }
        #endregion


        public virtual void Activated()
        {
            IsActive = true;
        }

        public virtual void LostActiviation()
        {
            IsActive = false;
        }

        public virtual void DocumentClosed()
        {

        }

        public virtual void Save()
        {

        }
    }
}
